{include file="Include/H_ui_head" /}
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户中心 <span class="c-gray en">&gt;</span> 用户管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="text-c">
        <form style="margin-left: 200px;margin-top: 10px" action="{:Url('Order/index')}" method="post">
	订单状态：<span class="select-box" style="width:150px;">
			<select class="select" name="state" size="1" id="state">
					<option value="">请选择</option>
					<option value="0">定金</option>
					<option value="1">违约</option>
					<option value="2">完成</option>
				</select>
			</span>
          订单号：<input type="text" class="input-text" name="identifier" style="width:250px" placeholder="输入订单号">
            <button type="submit" class="btn btn-success radius"><i class="Hui-iconfont">&#xe665;</i> 搜订单</button>
        </form>
    </div>
    <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><a href="javascript:;" onclick="proBatchDel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a></span><span class="r">共有数据：<strong>{$num}</strong> 条</span> </div>
    <div class="mt-20">
        <table class="table table-border table-bordered table-hover table-bg ">
            <thead>
            <tr class="text-c">
                <th width="25"><input type="checkbox" name="" value=""></th>
                <th width="70">ID</th>
                <th width="100">订单号</th>
                <th width="80">用户名</th>
                <th width="80">商品名称</th>
                <th width="80">购买时间</th>
                <th width="50">订单状态</th>
                <th width="100">操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name="data" id="rs" key="k"}
            <tr class="text-c">
                <td><input type="checkbox" value="{$rs['id']}" name="checkbox[]"></td>
                <td>{$rs['id']}</td>
                <td>{$rs['order_sn']}</td>
                <td>{$rs['username']}</td>
                <td>{$rs['goods_name']}</td>
                <td>{$rs['create_time']}</td>
                <td>
                {if $rs['status'] == 0}
                    定金
                {elseif $rs['status'] == 1}
                    违约
                {else}
                    成交
                {/if}
                </td>
                <td class="td-manage">
                    <a title="编辑" href="javascript:;" onclick="edit('编辑','{:Url('Order/edit',['id'=>$rs.id,'type'=>'edit'])}','7','','510')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
                    <a title="查看" href="javascript:;" onclick="edit('查看','{:Url('Order/edit',['id'=>$rs.id,'type'=>'see'])}','7','','710')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe725;</i></a>
                    <a title="删除" href="javascript:;" onclick="del(this,'{$rs['id']}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
                </td>
            </tr>
            {/volist}
            </tbody>
        </table>
        {$page}
        <!-- <div style="float: right">{}</div> -->
    </div>
</div>
{include file="Include/H_ui_foot" /}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__LIB__/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript">
	/*订单-编辑-查看*/
	function edit(title,url,id,w,h){
	    layer_show(title,url,w,h);
	}
	/*订单-查看*/
	function order_show(title,url,id,w,h){
	    layer_show(title,url,w,h);
	}
    /*订单-删除*/
    function del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: "{:Url('Order/del')}",
                dataType: 'json',
              	data : {id:id},
                success: function(data){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
    /*订单-批量删除*/
    function proBatchDel(){
    	var id = new Array();
    	var ids = $('[name="checkbox[]"]:checked');
    	if(ids.length==0){
    		 layer.msg('请选择要删除的工种类型',{icon:2});
    		 return;
    	}
    	else{
    		ids.each(function(){
    			id.push($(this).val());//将选中的值添加到数组chk_value中
    		})
    	}
    	var box = layer.confirm("您确定要删除吗？",function(){
                var loading = layer.msg('正在提交数据，请稍后...', {icon: 16,time:60000});
                $.post('{:url("Order/proBatchDel")}',{id:id.join(',')},function(data){
                    layer.close(loading);
                          if(data.code=='1'){
                            layer.msg(data.msg,{icon:1,time:2000});
                            location.reload();
                          }else{
                            layer.msg(data.msg,{icon:2,time:2000});
                          }
                    });
                });
    }
</script>
</body>
</html>
